package com.easyapi.server.service.user;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.easyapi.common.param.role.PageRoleParam;
import com.easyapi.common.param.role.RoleAddParam;
import com.easyapi.common.utils.BaseResponse;
import com.easyapi.common.vo.user.PageRoleVo;
import com.easyapi.common.vo.user.PermissionVo;
import com.easyapi.common.vo.user.RoleVo;
import com.easyapi.dao.entity.user.ApiCenterRole;
import com.easyapi.dao.entity.user.ApiCenterUser;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author javadadi
 */
public interface RoleService extends IService<ApiCenterRole> {

    List<RoleVo> listRoleVosByUserId(Long userId);

    List<RoleVo> listUserExRoles(Long userId);

    List<PermissionVo> listPermissionsByRoleId(Long roleId);

    List<PermissionVo> listRoleExPermission(Long roleId);

    boolean saveRole(RoleAddParam param);

    boolean addRolePermission(Long roleId, Long permissionId);

    boolean delRolePermission(Long roleId, Long permissionId);

    boolean deleteRole(Long id);

    Page<PageRoleVo> page(PageRoleParam param);

    List<PermissionVo> getPermissionByUserId(Long userId);

    List<String> getRolesByUserId(Long userId);

    boolean saveDefaultRole(ApiCenterUser user);

    boolean addRoleUsersByRoleIdAndUserId(Long roleId, Long userId);

    boolean delRoleUsersRoleIdAndUserId(Long roleId, Long userId);
}
